import React from 'react'
import {RouteObject, Navigate} from 'react-router-dom'
// 配置路由懒加载
const Discover = React.lazy(() => import('@/pages/discover/discover'))
const My = React.lazy(() => import('@/pages/my/my'))
const Focus = React.lazy(() => import('@/pages/focus/focus'))
const Download = React.lazy(() => import('@/pages/download/download'))
const Recommend = React.lazy(()=>import('@/pages/discover/component/recommend/recommend'))
const Album = React.lazy(()=>import('@/pages/discover/component/album/album'))
const Artist = React.lazy(()=>import('@/pages/discover/component/artist/artist'))
const DjRadio = React.lazy(()=>import('@/pages/discover/component/djradio/djRadio'))
const Ranking = React.lazy(()=>import('@/pages/discover/component/ranking/ranking'))
const PlayList = React.lazy(()=>import('@/pages/discover/component/playlist/playList'))
const routes: RouteObject[] = [
  {
    path: '/',
    element: <Navigate to="/discover"/>
  },
  {
    path: '/discover',
    element: <Discover/>,
    children: [
      {
        path: '/discover',
        element: <Navigate to={"/discover/recommend"}/>
      },
      {
        path: '/discover/recommend',
        element: <Recommend/>
      },
      {
        path: '/discover/ranking',
        element: <Ranking/>
      },
      {
        path: '/discover/playlist',
        element: <PlayList/>
      },
      {
        path: '/discover/djradio',
        element: <DjRadio/>
      },
      {
        path: '/discover/artist',
        element: <Artist/>
      },
      {
        path: '/discover/album',
        element: <Album/>
      }
    ]
  },
  {
    path: '/my',
    element: <My/>
  },
  {
    path: '/focus',
    element: <Focus/>
  },
  {
    path: '/download',
    element: <Download/>
  }
]
export default routes